package gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

import javax.swing.JButton;
import javax.swing.JFrame;

import control.MainMenuManager;
import control.Manager;

public class MenuButton extends JButton {

	public MenuButton(String s, Manager manager){
		
        super(s);
        
        setFont(GUI.font);
        createPerfectButton(manager, 0.5f);
	}
	
public MenuButton(String s, Manager manager, float align){
		
        super(s);
        
        setFont(GUI.font);
        createPerfectButton(manager,align);
	}

	public void createPerfectButton(Manager manager, float align){
        setForeground(GUI.FGMENU);
		setBorderPainted(false);
        setContentAreaFilled(false);
        setFocusPainted(false);
        setAlignmentX(align);
        
        // Changes the Color on Focus
        addFocusListener(new FocusListener() {
			@Override
			public void focusLost(FocusEvent arg0) {
				setForeground(GUI.FGMENU);
			}
			
			@Override
			public void focusGained(FocusEvent arg0) {
				setForeground(Color.CYAN);
			}
		});
        
        addActionListener((ActionListener) manager);
	}
	
	public MenuButton(String s, Manager manager, Font font, float align){
		
        super(s);
        setFont(font);
        createPerfectButton(manager,align);
	}
	
	public MenuButton(String s, Manager manager, Font font){
		
        super(s);
        setFont(font);
        createPerfectButton(manager,0.5f);
	}
}

